package com.tct.worktimeboard.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Huhailong
 * @Description 登录拦截器
 * @Date 2021/2/22.
 */
//@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Bean
    public LoginHandler getLoginIntercept() {
        return new LoginHandler();
    }

    @Autowired
    private LoginHandler loginHandler;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(loginHandler);
        registration.addPathPatterns("/**");
    }
}
